import requests

url = "http://localhost:8000/embed"
code_snippet = """
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println(\"Hello, World!\");
    }
}
"""

resp = requests.post(url, json={"text": code_snippet})
if resp.ok:
    data = resp.json()
    print("Embedding vector (dim {}):".format(len(data["embedding"])))
    print(data["embedding"][:10], "...")  # 只打印前10维
else:
    print("Error:", resp.text) 